<?php
    
require '../vendor/autoload.php';


    $hosts = [
    
          '101.132.73.77:9200' // ip和端口
     
];


    $client = Elasticsearch\ClientBuilder::create()
                                
                                            ->setHosts($hosts)
                                
                                            ->build();


     $params = [
    
             'index' => 'one',
    
             'type' => '_doc',
     
             'id' => '1', // 如果不提供id，es会自动生成
    
             'body' => 
                     ['first_name' => 'abc','age'=>123]
     
];



    $response = $client->index($params);
    print_r($response);
